{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![alt text](https://github.com/callysto/callysto-sample-notebooks/blob/master/notebooks/images/Callysto_Notebook-Banner_Top_06.06.18.jpg?raw=true)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Jupyter Test Drive - Typesetting with Markdown\n",
    "\n",
    "This notebook demonstrates the use of Markdown to type set documents in Jupyter. After working through this notebook, you will be able to edit the text in any notebook.  In addition, you will be able to assist your students in editing the text of their own notebooks. \n",
    "\n",
    "## The _very_ Basics\n",
    "\n",
    "Note that you can view the source code behind any cell by double clicking it. To re-render or re-run the cell, use any of these options:\n",
    "1. Select `Cell` $\\rightarrow$ `Run Cells`\n",
    "2. Hit `Shift-Enter` \n",
    "3. Click the `Run` button above"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Creating and Deleting Markdown Cells\n",
    "The first step you may want to do is to create a new cell for typesetting. To do that, while you have this cell selected, from the top menu click the plus (+) sign next to the save button."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Once you have created the new cell, you will get a blank `Code` cell above. To change that cell into one that you can use for typesetting, select the cell, and from the dropdown menu at the top, change `Code` $\\rightarrow$ `Markdown`. This changes that cell type into a markdown cell, and it can now be used for typesetting!\n",
    "\n",
    "\n",
    "The next step will be learning how to delete cells. Select the cell above that you converted to a markdown cell. To remove this cell from your Jupyter notebook  click `Edit` $\\rightarrow$ `Delete Cells`. If you accidentally deleted an incorrect cell, you can always bring it back by clicking `Edit` $\\rightarrow$ `Undo Delete Cells`."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Creating Titles\n",
    "\n",
    "Creating large bold title text in a Jupyter notebook with markdown is very simple! All you need to do is on a new line, type the pound sign and then a space. After the space, add your title. It's that simple. By adding extra pound signs, you will create different title levels. The cell below is unformatted markdown text demonstrating this."
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "# I am a level one title\n",
    "## I am a level two title\n",
    "### I am a level three title\n",
    "#### I am a level four title\n",
    "##### I am a level five title\n",
    "###### I am a level six title \n",
    "####### I would be a level seven title if such a thing existed\n",
    "\n",
    "If  # isn't the first character, that line does not get rendered as a title. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To see how those titles look when they're rendered in the Jupyter notebook, select the cell above, and from the top menu select `Raw NBConvert` $\\rightarrow$ `Markdown` (to change the cell from a raw type to a Markdown type), then press `Ctrl + Enter` to render the cell. Feel free to create a new cell and play with those, or change  the one above. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Creating Itemized Lists\n",
    "Creating lists in markdown in a Jupyter notebook is also straight forward! To do so you simply need to start a new line and begin counting. The markdown syntax is shown in the code below. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Double Click Me\n",
    "\n",
    "1. This is the first item of a list\n",
    "1. This is the second\n",
    "50. Notice how the numbers we use don't matter once it's rendered\n",
    "    1. By pressing the `Tab` key we can add sub items\n",
    "    45. The numbers don't matter here either\n",
    "        - We can add many sub-lists\n",
    "            - But at some point it starts to get redundant\n",
    "        - We can also go back a few levels of nesting by lining the text up with the line above\n",
    "2346. By going back to the original line, we leave our nested lists\n",
    "23236235672456. The numbers really don't matter.\n",
    "* In fact, you can give up on numbers at any time.\n",
    "1. Or start counting again\n",
    "    \n",
    "\n",
    "- We also don't need to have numbers if we don't want to!\n",
    "    * We have plenty of options\n",
    "-Notice how if we don't put a space between the dash and the first term it doesn't become a new item in the list!\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "### Exercise 1\n",
    "1. In the cell above, try fixing the last line so that the last item in the list becomes properly formatted once it's rendered. \n",
    "2. Create a new cell below, add a title, and an ordered list of your five favourite fruits.\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Links\n",
    "You can add hyper links to webpages anywhere you'd like right in the text. The syntax is as follows\n",
    "```markdown\n",
    "[text you want to display](link to a file or url page)\n",
    "```\n",
    "Change the cell below to markdown, run it, and see where the link takes you!"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "[this is the text that becomes the hyperlink](https://media.giphy.com/media/Vs44a88Dvbnkk/giphy.gif)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Images/gifs\n",
    "Images and gifs can be emebedded in a markdown cell nearly identically to placing a hyperlink. To display the image, add an exclamation point to the command as demonstrated below. \n",
    "```markdown\n",
    "![type anything here, it really doesn't matter, it's more for your reference](link in parenthesis)\n",
    "```\n",
    "would display an image/gif. It can either be a url link to an image, or one you have saved on the hub/locally. Change the cell below to markdown and run it to see it in action, or even embed your own images in this notebook. "
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "![type type type](https://media.giphy.com/media/gVoBC0SuaHStq/giphy.gif)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "### Exercise 2\n",
    "1. In a new cell below, embed an image of a cat. \n",
    "2. In the same cell, add a hyperlink below the image that links to the original image.\n",
    "3. Change the text displayed in the hyperlink to say \"Kitty Kitty\".\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Block Quotes\n",
    "Block quotes are a way to indent text/images with a grey bar in order to distinguish them from the main text. It is quite simlly done by adding a `>` at the beginning of a line. Change the cell below to markdown to see some examples"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "> This is an example of a block quote. You can type as long as you like and all the resulting text will be to the right of a the vertical grey bar. \n",
    "\n",
    "You can also use block quotes to easily format images with captions! \n",
    "\n",
    "> ![this image will be in block quotes](https://media.giphy.com/media/fs6rnt1K0YyVWRXNwY/giphy.gif)\n",
    ">\n",
    "> Now we can include a caption for images. This is nice because the image is now distinguishable from the main text. This makes it easy to include images without interrupting any narrative you've created. Notice how I have included a blank `>` under the image. That is so the spacing of this text looks nice underneath. Try removing it and see what happens"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Tables\n",
    "\n",
    "One can also create tables of data in Markdown. However, doing this manually is often not the most convenient. For large tables we recommend using online tools (such as [here](https://jakebathman.github.io/Markdown-Table-Generator/)) where you can copy-paste excel tables or csv files. This will then output syntax to properly render those tables. For smaller tables, it's quite easy to type out your own. See the cell below."
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "| This is the first column name| Second Column| Third|\n",
    "|---|---|-------------|\n",
    "|Notice how nothing is lined up when we type it | But that it looks nice when rendered| how convenient!|\n",
    "|shorter lines are good too| numbers?| 343453|\n",
    "|symbols| `yes`| $\\int e^{-x^2} dx$ |\n",
    "|also notice that the number of dashes in the second line don't matter | it just needs to be at least three| the rest are really only for you to make pre-rendering look nice |"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The basic table syntax is as follows:\n",
    "```markdown\n",
    "|initialize| your| column| names|\n",
    "|----------|-----|-------|------| <- this line sets up the headers, need at least three `---` each line\n",
    "|     data | data| data  | data | <- any kind of text data can be put in a table. Feel free to mix too!\n",
    "| numbers  | text| text  | data   <- you don't need to include the right-most pipe if you don't want to\n",
    "```\n",
    "\n",
    "The syntax can be thought of as how you would try to write a table directly using symbols on your keyboard. Play with the table in the cell above, or create a new cell and try making your own! You could put one in this cell as well and put a table here. Double click anywhere on this cell to open edit mode."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "### Exercise 3\n",
    "1. Using sample notebooks, teachers may like or dislike various sections of the sample provided. Luckily, it's easy to make these minor changes in notebooks. In the two cells below: \n",
    "    * remove the second cell because you won't need it in your lesson\n",
    "    * remove the last paragraph in the first cell \n",
    "    * change the date in the first paragraph\n",
    "2. In the first cell below, take the ordered list out of the block quote. \n",
    "\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "> ## Properties of Random Numbers\n",
    "> \n",
    "> May 22, 2018  \n",
    "> Suppose you have a sequence of $N$ random numbers $\\{R\\}$ with contents $\\{r_1, r_2, ... , r_N\\}$ where each element $r_i$ is a random number. What sort of properties should this sequence of numbers have? If this is truly a sequence of random numbers, it _must_ satisfy the following properties, which we will explain in greater detail: \n",
    "> \n",
    "> 1. Drawing any $r_i$ is equally probable and independent. \n",
    "> 2. The sequence of random numbers is uniformly distributed. \n",
    "> \n",
    "> \"Drawing a value\" in this scope means we're picking a number from our sequence of random numbers, but not removing it from the sequence (the sequence remains unchanged, we're simply \"observing\" the random number). \n",
    "Let's look at these two properties in a little more detail. \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "> ### All Values Are Equally Probable and Independent\n",
    "> \n",
    "> What this means is that if you were to select (but not remove) a number from your sequence of random numbers $\\{r_1, r_2, ... , r_N\\}$ at random, the probability of drawing any of those numbers is\n",
    "\\begin{equation}\n",
    "p(r_i) = \\frac{1}{N}\n",
    "\\end{equation}\n",
    "where $p(r_i)$ is the probability of selecting a number $r_i$. This probability is identical for all numbers within your set. More explicitly:\n",
    "\\begin{equation}\n",
    "p(r_1) = p(r_2) = ... = p(r_N) = \\frac{1}{N}\n",
    "\\end{equation}\n",
    "> \n",
    "> The independence property means that the if you draw a number from the set, it does not affect the probability of drawing other numbers, or even itself at a later time. This is because the sequence remains unchanged after you draw (observe) a number."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![alt text](https://github.com/callysto/callysto-sample-notebooks/blob/master/notebooks/images/Callysto_Notebook-Banners_Bottom_06.06.18.jpg?raw=true)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
